// tcl wrapper for EndoscopeRenderWidget object
//
#define VTK_WRAPPING_CXX
#define VTK_STREAMS_FWD_ONLY
#include "vtkSystemIncludes.h"
#include "VirtualDisplayWidget.h"

#include "vtkTclUtil.h"
#include <vtkstd/stdexcept>
#include <vtksys/ios/sstream>

ClientData vtkVirtualDisplayWidgetNewCommand()
{
	vtkVirtualDisplayWidget *temp = vtkVirtualDisplayWidget::New();
	return static_cast<ClientData>(temp);
}

int vtkSlicerWidgetCppCommand(vtkSlicerWidget *op, Tcl_Interp *interp,
								int argc, char *argv[]);
int  vtkVirtualDisplayWidgetCppCommand(vtkVirtualDisplayWidget *op, Tcl_Interp *interp,
									 int argc, char *argv[]);

int  vtkVirtualDisplayWidgetCommand(ClientData cd, Tcl_Interp *interp,
								  int argc, char *argv[])
{
	if ((argc == 2)&&(!strcmp("Delete",argv[1]))&& !vtkTclInDelete(interp))
	{
		Tcl_DeleteCommand(interp,argv[0]);
		return TCL_OK;
	}
	return vtkVirtualDisplayWidgetCppCommand(static_cast<vtkVirtualDisplayWidget *>(static_cast<vtkTclCommandArgStruct *>(cd)->Pointer),interp, argc, argv);
}

int /*VTKTCL_EXPORT*/ vtkVirtualDisplayWidgetCppCommand(vtkVirtualDisplayWidget *op, Tcl_Interp *interp,
													  int argc, char *argv[])
{
	int    tempi;
	double tempd;
	static char temps[80];
	int    error;

	error = 0; error = error;
	tempi = 0; tempi = tempi;
	tempd = 0; tempd = tempd;
	temps[0] = 0; temps[0] = temps[0];

	if (argc < 2)
	{
		Tcl_SetResult(interp,(char *)("Could not find requested method."), TCL_VOLATILE);
		return TCL_ERROR;
	}
	if (!interp)
	{
		if (!strcmp("DoTypecasting",argv[0]))
		{
			if (!strcmp("vtkSlicerWidget",argv[1]))
			{
				argv[2] = static_cast<char *>(static_cast<void *>(op));
				return TCL_OK;
			}
			if (vtkSlicerWidgetCppCommand(static_cast<vtkSlicerWidget *>(op),interp,argc,argv) == TCL_OK)
			{
				return TCL_OK;
			}
		}
		return TCL_ERROR;
	}

	if (!strcmp("GetSuperClassName",argv[1]))
	{
		Tcl_SetResult(interp,(char *)("vtkVirtualDisplayWidget"), TCL_VOLATILE);
		return TCL_OK;
	}

	try
	{
		if (!strcmp("SayHello",argv[1]))
		{
			Tcl_SetResult(interp,(char *)("Hello"), TCL_VOLATILE);
			return TCL_OK;
		}
		if ((!strcmp("Render",argv[1]))&&(argc == 2))
		{
			op->Render();
			Tcl_ResetResult(interp);
			return TCL_OK;
		}

		/*	if ((!strcmp("IsA",argv[1]))&&(argc == 3))
		{
		char    *temp0;
		int      temp20;
		error = 0;

		temp0 = argv[2];
		if (!error)
		{
		temp20 = (op)->IsA(temp0);
		char tempResult[1024];
		sprintf(tempResult,"%i",temp20);
		Tcl_SetResult(interp, tempResult, TCL_VOLATILE);
		return TCL_OK;
		}
		}*/
		//if ((!strcmp("NewInstance",argv[1]))&&(argc == 2))
		//{
		//	EndoscopeRenderWidget  *temp20;
		//	temp20 = (op)->NewInstance();
		//	vtkTclGetObjectFromPointer(interp,(void *)(temp20),"EndoscopeRenderWidget");
		//	return TCL_OK;
		//}

		//if ((!strcmp("New",argv[1]))&&(argc == 2))
		//{
		//	vtkEndoscopeRenderWidget  *temp20;
		//	temp20 = (op)->New();
		//	vtkTclGetObjectFromPointer(interp,(void *)(temp20),"vtkEndoscopeRenderWidget");
		//	return TCL_OK;
		//}

		if (vtkSlicerWidgetCppCommand(static_cast<vtkSlicerWidget *>(op),interp,argc,argv) == TCL_OK)
		{
			return TCL_OK;
		}
	}
	catch (vtkstd::exception &e)
	{
		Tcl_AppendResult(interp, "Uncaught exception: ",  e.what(), "\n", NULL);
		return TCL_ERROR;
	}
	return TCL_ERROR;
}
